<?php
namespace Admin\Model;
use Think\Model\RelationModel;

class OrderGoodModel extends RelationModel
{
    protected $_link = array(
        //商品表
        'good' => array(
            'mapping_type' => self::BELONGS_TO,
            'class_name' => 'Good',
            'foreign_key' => 'good_id',
            'mapping_fields' => 'g_name,img,id,brand_id,type,price,is_back,noback_reason',
            'as_fields' => 'g_name,img,id,brand_id,type,price,is_back,noback_reason'
        ),
        'order' => array(
            'mapping_type' => self::HAS_MANY,
            'class_name' => 'order',
            'foreign_key' => 'id',
            'parent_key' => 'parent_order_id',
        )
    );
}